/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.feiyue.helper;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class AnimationTabHost extends TabHost {
	private static Animation slideLeftIn;
	private static Animation slideLeftOut;
	private static Animation slideRightIn;
	private static Animation slideRightOut;
	public String direction = "";
	private boolean isOpenAnimation;
	private int mTabCount;

	public AnimationTabHost(Context paramContext, AttributeSet paramAttributeSet) {
		super(paramContext, paramAttributeSet);
		slideLeftIn = AnimationUtils.loadAnimation(paramContext, 2130968586);
		slideLeftOut = AnimationUtils.loadAnimation(paramContext, 2130968588);
		slideRightIn = AnimationUtils.loadAnimation(paramContext, 2130968587);
		slideRightOut = AnimationUtils.loadAnimation(paramContext, 2130968589);
		this.isOpenAnimation = false;
	}

	public void addTab(TabHost.TabSpec paramTabSpec) {
		this.mTabCount = (1 + this.mTabCount);
		super.addTab(paramTabSpec);
	}

	public int getTabCount() {
		return this.mTabCount;
	}

	public void setCurrentTab(int i)
    {
        int j = getCurrentTab();
        if (getCurrentView() != null && isOpenAnimation)
            if (j == -1 + mTabCount && i == 0)
                getCurrentView().startAnimation(slideRightOut);
            else
            if (j == 0 && i == -1 + mTabCount)
                getCurrentView().startAnimation(slideLeftOut);
            else
            if (i > j)
                getCurrentView().startAnimation(slideLeftOut);
            else
            if (i < j)
                getCurrentView().startAnimation(slideRightOut);
        super.setCurrentTab(i);
        if (getCurrentView() != null && isOpenAnimation)
            if (j == -1 + mTabCount && i == 0)
                getCurrentView().startAnimation(slideLeftIn);
            else
            if (j == 0 && i == -1 + mTabCount)
                getCurrentView().startAnimation(slideRightIn);
            else
            if (i > j)
                getCurrentView().startAnimation(slideRightIn);
            else
            if (i < j)
                getCurrentView().startAnimation(slideLeftIn);
    }

	public void setOpenAnimation(boolean paramBoolean) {
		this.isOpenAnimation = paramBoolean;
	}

	public boolean setTabAnimation(int[] paramArrayOfInt) {
		if (3 == paramArrayOfInt.length) {
			slideLeftIn = AnimationUtils.loadAnimation(getContext(),
					paramArrayOfInt[0]);
			slideLeftOut = AnimationUtils.loadAnimation(getContext(),
					paramArrayOfInt[1]);
			slideRightIn = AnimationUtils.loadAnimation(getContext(),
					paramArrayOfInt[2]);
			slideRightOut = AnimationUtils.loadAnimation(getContext(),
					paramArrayOfInt[3]);
			return true;
		}
		return false;
	}
}